package com.atguigu.wordcount.sort;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

/**
 * @ClassName SortMapper
 * @DeScription SortMapper
 * @Author 剧情再美终是戏
 * @Date 2019/11/19 9:26
 * @Version 1.0
 **/
public class SortMapper extends Mapper<LongWritable, Text, LongWritable, Text> {

    private LongWritable out_key = new LongWritable();

    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String[] split = value.toString().split("\t");
        out_key.set(Long.parseLong(split[3]));
        context.write(out_key, value);
    }
}
